import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VuePreview from 'vue-preview'
import qs from 'qs'
import Avatar from 'vue-avatar'
import './assets/style.css'
import fHeader from './components/f-header'
import fFooter from './components/f-footer'
import i18n from './i18n/i18n'
import axios from 'axios'
import'./static/Ueditor/ueditor.config.js'
import'./static/Ueditor/ueditor.all.min.js'
import'./static/Ueditor/lang/zh-cn/zh-cn.js'
import'./static/Ueditor/ueditor.parse.min.js'

Vue.use(qs)
Vue.config.productionTip = false

Vue.prototype.axios = axios

//Vue.use(VueRouter)
Vue.component("f-header",fHeader)
Vue.component("f-footer",fFooter)


Vue.use(VuePreview)

Vue.use(router)

Vue.use(ElementUI)

Vue.config.productionTip = false

Storage.prototype.setExpire = (key, value, expire) => {
	let obj = {
	data: value,
	time: Date.now(),
	expire: expire
	};
	//localStorage 设置的值不能为对象,转为json字符串
	localStorage.setItem(key, JSON.stringify(obj));
}

Storage.prototype.getExpire = key => {
    let val = localStorage.getItem(key);
    if (!val) {
        return val;
    }
    val = JSON.parse(val);
    if (Date.now() - val.time > val.expire) {
        localStorage.removeItem(key);
        return null;
    }
    return val.data;
}

new Vue({
  Avatar,
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')


